09. TensorDataset & Batching Data

8 TensorDataset Batching V1

Omission: shuffling data

Make sure to shuffle your data, so that your model doesn't learn anything about the ordering of the data, and instead can focus on the content . We can do this with a DataLoader by setting shuffle=True . You'll find this updated code in the exercise and solution notebooks.

# make sure to SHUFFLE your data
train_loader = DataLoader(train_data, shuffle=True, batch_size=batch_size)
valid_loader = DataLoader(valid_data, shuffle=True, batch_size=batch_size)
test_loader = DataLoader(test_data, shuffle=True, batch_size=batch_size)

TensorDataset

Take a look at the source code for the TensorDataset class , you can see that it's "purpose" is to provide an easy way to create a dataset out of standard data structures .